//this file cleans GED data

global direc "[YOUR PATH HERE]"
global data "${direc}/data"


clear
set more off
	
********************************************************************************
//load in SET data first

use "${direc}/GED_long.dta", clear


preserve
	collapse (sum) completers passers , by(year)
	
	graph twoway (line completers year) (line passers year), ///
		legend(col(2) order(1 "Completers" 2 "Passers"))
		graph export ${output}/ged_counts`bal'.pdf, replace
	
restore

gen statefips = .
//consolidate statefips and state names
	replace statefips = 1 if state == "Alabama"
	replace statefips = 2 if state == "Alaska"
	replace statefips = 4 if state == "Arizona"
	replace statefips = 5 if state == "Arkansas"
	replace statefips = 6 if state == "California"
	replace statefips = 8 if state == "Colorado"
	replace statefips = 9 if state == "Connecticut"
	replace statefips = 10 if state == "Delaware"
	replace statefips = 11 if state == "DistrictofColumbia"
	replace statefips = 12 if state == "Florida"
	replace statefips = 13 if state == "Georgia"
	replace statefips = 15 if state == "Hawaii"
	replace statefips = 16 if state == "Idaho"
	replace statefips = 17 if state == "Illinois"
	replace statefips = 18 if state == "Indiana"
	replace statefips = 19 if state == "Iowa"
	replace statefips = 20 if state == "Kansas"
	replace statefips = 21 if state == "Kentucky"
	replace statefips = 22 if state == "Louisiana"
	replace statefips = 23 if state == "Maine"
	replace statefips = 24 if state == "Maryland"
	replace statefips = 25 if state == "Massachusetts"
	replace statefips = 26 if state == "Michigan"
	replace statefips = 27 if state == "Minnesota"
	replace statefips = 28 if state == "Mississippi"
	replace statefips = 29 if state == "Missouri"
	replace statefips = 30 if state == "Montana"
	replace statefips = 31 if state == "Nebraska"
	replace statefips = 32 if state == "Nevada"
	replace statefips = 33 if state == "NewHampshire"
	replace statefips = 34 if state == "NewJersey"
	replace statefips = 35 if state == "NewMexico"
	replace statefips = 36 if state == "NewYork"
	replace statefips = 37 if state == "NorthCarolina"
	replace statefips = 38 if state == "NorthDakota"
	replace statefips = 39 if state == "Ohio"
	replace statefips = 40 if state == "Oklahoma"
	replace statefips = 41 if state == "Oregon"
	replace statefips = 42 if state == "Pennsylvania"
	replace statefips = 44 if state == "RhodeIsland"
	replace statefips = 45 if state == "SouthCarolina"
	replace statefips = 46 if state == "SouthDakota"
	replace statefips = 47 if state == "Tennessee"
	replace statefips = 48 if state == "Texas"
	replace statefips = 49 if state == "Utah"
	replace statefips = 50 if state == "Vermont"
	replace statefips = 51 if state == "Virginia"
	replace statefips = 53 if state == "Washington"
	replace statefips = 54 if state == "WestVirgina"
	replace statefips = 55 if state == "Wisconsin"
	replace statefips = 56 if state == "Wyoming"
	
drop state
rename year year_academic

**merge in ged extra data

//append using "${JT}/misc_data/ged_extra.dta"

//replace percentage = passers/completers if missing(percentage)

save "${direc}/data/clean_GED_long.dta", replace
